
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef __TS_HTTP_H
#define __TS_HTTP_H
#include "base.h"
#include <libwebsockets.h>
struct http_struct {
  void *parent;
  void *handle;
  char *origin;
  int port;
  int interrupted;
  struct lws_context *context;
  struct lws_spa *spa;
  struct lws *client_wsi;
  char *url;
  int urlLen;
  char *body;
  int bodyLen;
  lws_sorted_usec_list_t *_sul;
  const lws_retry_bo_t *_retry;
  const char *const *param_names;
  const char *server_address;
  char *pro;

  int fd;
  size_t file_length;
  int param_names_size;
  char *filename;
  void *(*set_param_names)(void *, void **, int *);
};
void *http_request(const char *method, const char *uri,
    const char *post_data, size_t data_len, void *user_data);
void *http_request_digest(const char *method, const char *uri,
    const char *post_data, size_t data_len, size_t *size_p,
    const char *username, const char *password);
void *http_ws_httpd_run(void *ptr);
void *http_ws_httpd_thread(void *ptr);

void *http__init(int argc, const char * const *argv);
typedef void * (*http_handle)(void *, const char *, const char *,
    int);
void *http__ws_httpd__thread(void *ptr);
#endif //__TS_HTTP_H
